﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using eProject.Logic;
using eProject.Model;

namespace ViewModel
{
    public class TaskViewModel :BaseViewModel
    {
        private readonly Activities _activities;
        private readonly Task _task;

        private readonly ICollection<ActivityViewModel> _actVMs = new LinkedList<ActivityViewModel>();

        public TaskViewModel(Activities activities, Task task)
        {
            _activities = activities;
            _task = task;

            var acts = _activities.GetActivities(_task);
            foreach (var act in acts)
            {
                _actVMs.Add(new ActivityViewModel(_activities, act));
            }
        }

        public ActivityViewModel CreateActivity(Employee employee, Period period, int priority)
        {
            var act = new Activity(_task, employee, period, priority);
            _activities.AddActivity(act);            
            return null; //TODO returns null!
        }

        private void OnActivityAdded(Activity activity)
        {
            var actVM = new ActivityViewModel(_activities, activity);
            _actVMs.Add(actVM);
        }

        private void OnActivityRemoved(Activity activityi)
        {
            
        }
    }
}
